<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zhaoyingjie
  Date: 2021/9/24
  Time: 19:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>职位列表</title>
    <link rel="icon" href="/hire/imgs/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/hire/css/job/recruitment/recruitment.css">
    <link rel="stylesheet" href="/hire/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/hire/plugins/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/hire/plugins/layui/city-picker/city-picker.css">
</head>
<body class="body">
<%@include file="./../../common/mynav.jsp" %>

<div class="search">
    <div class="inner">
        <div class="find">
            <form action="#" class="search-form">
                <input value="${name}" id="title" class="search-content" type="text" placeholder="Java">
                <input class="search-button" type="button" value="搜索" onclick="search_name()">
            </form>
        </div>

        <div class="bt1">
            <div class="city">
                <div class="hot-city">
                    <ul>
                        <li>热门城市:</li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">全国</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">北京市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">上海市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">广州市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">深圳市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">杭州市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">天津市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">西安市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">苏州市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">武汉市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">厦门市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">长沙市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">成都市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">郑州市</a></li>
                        <li><a href="javascript:void(0)" onclick="searchAll(this)">重庆市</a></li>
                        <li>
<%--                            全部城市--%>
                            <form class="layui-form layui-form-pane">
                                <div class="layui-form-item layui-col-md8">
                                    <div class="layui-input-block" id="city2" >
                                        <input type="text"  autocomplete="on" class="layui-input" style="width: 250px" id="address" name="city-picker" readonly="readonly" data-toggle="city-picker" placeholder="全部城市" value="${province}/${city}/${district}">
                                    </div>
                                </div>
                                    <div class="layui-form-item">
                                        <div class="layui-input-inline">
                                            <button type="button" class="layui-btn" lay-submit lay-filter="citypickerDemo" onclick="searchCity()">确认</button>
<%--                                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>--%>
                                        </div>
                                    </div>
                            </form>

                        </li>

                    </ul>

                </div>
            </div>

            <div class="place">
                <div class="dropdown">
                    <button type="button" class="btn dropdown-toggle" id="dropdownMenu1"
                            data-toggle="dropdown">
                        工作经验&nbsp;&nbsp;&nbsp;
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="findexperience1(this)">全部</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="findexperience1(this)">不限</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="findexperience1(this)">1-3年</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="findexperience1(this)">3-5年</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="findexperience1(this)">5-10年</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="findexperience1(this)">10年以上</a>
                        </li>
                    </ul>
                </div>
                <div class="dropdown">
                    <button type="button" class="btn dropdown-toggle" id="dropdownMenu1"
                            data-toggle="dropdown">
                        学历要求&nbsp;&nbsp;&nbsp;
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)"
                               onclick="findeducation(this)">全部</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)"
                               onclick="findeducation(this)">不限</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)"
                               onclick="findeducation(this)">专科</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)"
                               onclick="findeducation(this)">本科</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)"
                               onclick="findeducation(this)">硕士</a>
                        </li>
                        <li role="presentation" class="divider"></li>
                        <li role="presentation">
                            <a role="menuitem" tabindex="-1" href="javascript:void(0)"
                               onclick="findeducation(this)">博士</a>
                        </li>
                    </ul>
                </div>
                <div class="dropdown">
<%--                    <button type="button" class="btn dropdown-toggle" id="dropdownMenu1"--%>
<%--                            data-toggle="dropdown">--%>
<%--                        薪资要求&nbsp;&nbsp;&nbsp;--%>
<%--                        <span class="caret"></span>--%>
<%--                    </button>--%>
                    <div class="ctn">
                        薪资要求&nbsp;&nbsp;&nbsp;
<%--                        <span class="car"></span>--%>
                        <input type="text" style="width:60px; height: 20px" value="${salaryLower}" id="lower">&nbsp;K&nbsp;-&nbsp;<input type="text" style="width:60px; height: 20px" value="${salaryUpper}" id="upper">&nbsp;K
                        <button type="button" style="width: 50px;line-height: 20px;margin-left: 20px" onclick="searchmoney()">确认</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="company-totality">
    <div class="company-box">
        <div class="company-zero">
            <c:forEach items="${recruitmentCompany}" var="r" varStatus="rc">
                <div class="Rborder">
                    <div class="company">
                        <div class="company-info" onclick="find_id(this)">
                            <input type="hidden" value="${r.recruitment.id}">
                            <div class="comp-name1"><a>${r.recruitment.name}</a></div>
                            <div class="comp" style="color: red">${r.recruitment.salaryLower}K-${r.recruitment.salaryUpper}K</div>
                            <div class="comp">${r.recruitment.education}</div>
                            <div class="comp"> |</div>
                            <div class="comp">${r.recruitment.contactName}</div>
                        </div>
                        <div class="company-info2" onclick="find_cid(this)">
                            <input type="hidden" value="${r.company.id}">
                            <div class="comp-name2"><a>${r.company.name}</a></div>
                            <div class="comp">${r.company.industryType}</div>
                            <div class="comp"> |</div>
                            <div class="comp">${r.company.financing}</div>
                            <div class="comp"> |</div>
                            <div class="comp">${r.company.num}</div>
                        </div>
                    </div>
                    <div class="tag">
                        <c:forEach items="${r.tagList}" var="t">
                            <div class="tag-1">
                                <div class="comp4">${t}</div>
                            </div>
                        </c:forEach>
                        <div class="tag-2">
                            <div class="comp5">${r.recruitment.welfare}</div>
                        </div>
                    </div>
                </div>
            </c:forEach>
        </div>
    </div>
</div>
<div class="page">
    <%@include file="../../common/page.jsp" %>
    <input type="hidden" value="${recruitment.pageNum}" id="page">
</div>

<%@include file="./../../common/myfooter.jsp" %>
<script src="../../plugins/layui/layui.js"></script>
<script src="../../plugins/jquery/jquery.min.js"></script>
<script src="../../plugins/bootstrap/js/bootstrap.js"></script>
<script src="/hire/js/common/page.js"></script>
<script src="../../plugins/layui/city-picker/city-picker.data.js"></script>
<script src="../../plugins/layui/city-picker/city-picker.js"></script>
<script>
    function find_id(obj) {
        let rid = obj.children[0].value;
        // console.log(rid)
        $.post('/hire/job/count', {rid: rid}, function (res) {
            if (res.code == "200") {
                window.location = "/hire/job/recruitment/recruitmentinfo?id=" + rid;
            }
        })
    }

    function find_cid(obj) {
        let cid = obj.children[0].value;
        window.location = "/hire/job/company/companyinfo?id=" + cid;
    }

    function search_name() {
        let title = $("#title").val();
        let page=$("#page").val();
        let lower=$("#lower").val();
        let upper = $("#upper").val();
        window.location = "/hire/job/recruitment/recruitment?name=" + title+"&page="+1+"&salaryLower="+lower+"&salaryUpper="+upper;
    }

    function findexperience1(obj) {
        let title = $("#title").val();
        let lower=$("#lower").val();
        let upper = $("#upper").val();
        let text = obj.innerText
        if (text == ("全部")) {
            text = ""
            window.location = "/hire/job/recruitment/recruitment?experience=" + text+"&name="+title+"&salaryLower="+lower+"&salaryUpper="+upper;

        } else {
            window.location = "/hire/job/recruitment/recruitment?experience=" + text+"&name="+title+"&salaryLower="+lower+"&salaryUpper="+upper;
        }
        // window.location="/hire/job/recruitment/recruitment?experience="+text;
    }

    function findeducation(obj) {
        let title = $("#title").val();
        let lower=$("#lower").val();
        let upper = $("#upper").val();
        let education = obj.innerText
        if (education == ("全部")) {
            education = ""
            window.location = "/hire/job/recruitment/recruitment?education=" + education+"&name="+title+"&salaryLower="+lower+"&salaryUpper="+upper;
        } else {
            window.location = "/hire/job/recruitment/recruitment?education=" + education+"&name="+title+"&salaryLower="+lower+"&salaryUpper="+upper;
        }
    }

    function searchmoney(){
        let lower=$("#lower").val();
        let upper = $("#upper").val();
        let title = $("#title").val();
        window.location = "/hire/job/recruitment/recruitment?salaryLower=" + lower+"&salaryUpper="+upper+"&name="+title;
    }

    function searchAll(obj) {
        let cityAll=obj.innerText;
        let title = $("#title").val();
        if(cityAll == ("全国")){
            window.location="/hire/job/recruitment/recruitment";
        }else{
            window.location="/hire/job/recruitment/recruitment?city="+cityAll+"&name="+title;
        }
    }
    function searchCity(){
        let title = $("#title").val();
        let province=document.getElementById("city2").children[1].children[1].children[0].innerText;
        let city=document.getElementById("city2").children[1].children[1].children[2].innerText;
        let district=document.getElementById("city2").children[1].children[1].children[4].innerText
        window.location="/hire/job/recruitment/recruitment?province="+province+"&city="+city+"&district="+district+"&name="+title;
    }

    layui.extend({
        citypicker:'{/}./plugin/layui/extend/city-picker/city-picker'
    }).use(['jquery','citypicker','form'],function(){
        var $ = layui.$,
            form = layui.form,
            citypicker = layui.citypicker;

        var cityPicker = new citypicker("#address",{
            provincename:"provinceId",
            cityname:"cityId",
            districtname: "districtId",
            level: 'districtId',// 级别
        })
        // console.log(provincename)
    });


    layui.use(['dropdown', 'util', 'layer', 'table'], function () {
        var dropdown = layui.dropdown
            , util = layui.util
            , layer = layui.layer
            , table = layui.table
            , $ = layui.jquery;

        //初演示
        dropdown.render({
            elem: '.demo1'
            , data: [{
                title: 'menu item11'
                , id: 100
            }, {
                title: 'menu item22'
                , id: 101
            }, {
                title: 'menu item33'
                , id: 102
            }]
            , click: function (obj) {
                layer.tips('点击了：' + obj.title, this.elem, {tips: [1, '#5FB878']})
            }
        });

    });
    layui.use(['laypage', 'layer'], function () {
        var laypage = layui.laypage
            , layer = layui.layer;

        //总页数低于页码总数
        laypage.render({
            elem: 'demo0'
            , count: 50 //数据总数
        });
    });
</script>
</body>
</html>
